package com.mate.cloud.transaction.service.impl;

import com.mate.cloud.transaction.domain.UserVO;
import com.mate.cloud.transaction.service.EmpService;
import com.mate.cloud.transaction.service.OrderService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
public class EmpServiceImpl implements EmpService {

    @Resource
    private OrderService orderService;

    @Transactional
    @Override
    public void add(UserVO userVO) {
        saveUser(userVO);
    }

    /**
     * 5、多线程调用
     * @param userVO
     */
    @Override
    public void addUser(UserVO userVO) {
        new Thread(()-> orderService.updateSataus()).start();
    }


    private void saveUser(UserVO userVO) {
        System.out.println("======================" + userVO);
    }


}
